home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / c01lab1.zip / ADAWKBK / SOL2-1.ADA < prev    next >
Text File  |  1992-11-11  |  731b  |  33 lines

  1. -- Problem 2.1
  2. -- by Rick Conn
  3. package Colors is
  4.  
  5.   type COLOR is (RED, GREEN, BLUE, YELLOW, ORANGE,
  6.                  TURQUOISE, MAGENTA, VIOLET);
  7.  
  8.   procedure Display (Last_Color : in COLOR);
  9.  
  10. end Colors;
  11.  
  12. with Text_IO;  -- context clause
  13. package body Colors is
  14.  
  15.   procedure Display (Last_Color : in COLOR) is
  16.   begin
  17.     Text_IO.Put_Line ("Color Display:");
  18.     for C in COLOR'FIRST .. Last_Color loop
  19.       Text_IO.Put_Line ("   " & COLOR'IMAGE(C));
  20.         -- string concatenation is used to offset the image
  21.     end loop;
  22.   end Display;
  23.  
  24. end Colors;
  25.  
  26. with Colors;
  27. procedure Main is
  28. begin
  29.   Colors.Display(Colors.ORANGE);
  30.   Colors.Display(Colors.RED);
  31.   Colors.Display(Colors.VIOLET);
  32. end Main;
  33.